<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<button id="btn">下载</button>
<script>
    var url = 'http://192.168.1.100:9000/project/work/5a98c6b0ef7846699cc6d756ff16bd52.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=admin%2F20240704%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240704T114549Z&X-Amz-Expires=172800&X-Amz-SignedHeaders=host&X-Amz-Signature=4ede90dfe362d298baedef0c73f8fa079f4c323b2a84b0dc9a3b43f845d2139f'
    /*function downloadFile (url, name) {
        var a = document.createElement('a');
        a.style.display = 'none';
        document.body.appendChild(a);
        a.href = url;
        a.download = name;
        a.click();
        document.body.removeChild(a);
    }*/
    function downloadFile (url, name) {
        fetch(url).then((res) => res.blob())
            .then((blob) => {
                var a = document.createElement('a')
                var url = window.URL.createObjectURL(blob)
                a.href = url
                a.download = name
                a.click()
                window.URL.revokeObjectURL(url)
            })
    }

    document.querySelector('#btn').addEventListener('click', (e) => {
        downloadFile(url, '46699cc6d756ff16bd52.png')
    })
</script>
</body>
</html>